#pragma once

#include <cstdint>
#include <vector>
#include <initializer_list>

namespace cyb
{

class VertexLayout
{
public:
	enum class Attribute
	{
		Position,			// a_position
		Normal,				// a_normal
		Color0,				// a_color0
		Color1,				// a_color1
		Indices,			// a_indices
		TexCoord0,			// a_texcoord0
		TexCoord1,			// a_texcoord1
		TexCoord2,			// a_texcoord2
		TexCoord3,			// a_texcoord3
	};

	enum class Type
	{
		Uint8,
		Uint16,
		HalfFloat,
		Float
	};

	struct Entry
	{
		Entry( Attribute attribute, uint8_t size, Type type, bool normalized = false );
		Attribute m_attribute;
		Type m_type;
		uint8_t m_size;
		uint32_t m_offset;
		bool m_normalized;
	};

	using InitList = std::initializer_list<Entry>;

	VertexLayout( const InitList& init );
	~VertexLayout() = default;

	uint32_t Hash() const;
	uint32_t Stride() const;
	const std::vector<Entry>& Layout() const;
	void Print() const;

private:
	uint32_t m_hash;
	uint16_t m_stride;
	std::vector<Entry> m_layout;
};

std::string AttributeToString( const VertexLayout::Attribute attribute );
std::string AttributeTypeToString( const VertexLayout::Type type );

}	// namespace cyb